package com.allenkerr.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.SimpleTimeZone;

/**
 * Created by 小柯 on 17/6/28.
 */
@Document(collection = "men")
public class Man {

    public final static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    static {
        dateFormat.setCalendar(new GregorianCalendar(new SimpleTimeZone(0, "GMT")));
    }

    //public final static SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");

    @Id
    private Integer id;

    private String name;

    private Goddess goddess;

    private Date birthday;

    public Man() {
    }

    public Man(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Man(Integer id, String name, Goddess goddess) {
        this.id = id;
        this.name = name;
        this.goddess = goddess;
    }

    public Man(Integer id, String name, Goddess goddess, Date birthday) {
        this.id = id;
        this.name = name;
        this.goddess = goddess;
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "Man{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", goddess=" + goddess +
                ", birthday=" + dateFormat.format(birthday) +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Goddess getGoddess() {
        return goddess;
    }

    public void setGoddess(Goddess goddess) {
        this.goddess = goddess;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
}
